//
//  BTChain.UIAlertController.swift
//  BTChain
//
//  Created by Jiang Chencheng on 2024/7/25.
//

import UIKit

extension UIAlertController: Compatible {}

public extension ChainBox where T: UIAlertController {
    @discardableResult
    func addAction(_ action: UIAlertAction) -> ChainBox {
        value.addAction(action)
        return value.x
    }

    @discardableResult
    func addTextField(_ configurationHandler: ((UITextField) -> ())? = nil) -> ChainBox {
        value.addTextField(configurationHandler: configurationHandler)
        return value.x
    }

    @discardableResult
    func show(in viewController: UIViewController) -> ChainBox {
        viewController.present(value, animated: true)
        return value.x
    }
}

